/*
 * @Author: Shane
 * @Date: 2022-06-30 15:31:05
 * @LastEditTime: 2022-06-30 16:17:53
 * @LastEditors: Shane
 * @Description: 
 * @FilePath: /app-framework/common_widgets/lib/loading/ball_style.dart
 */

import 'package:flutter/material.dart';

const kDefaultBallStyle = BallStyle(
  size: 10.0,
  color: Colors.white,
  ballType: BallType.solid,
  borderWidth: 0.0,
  borderColor: Colors.white,
);

enum BallType {
  ///
  /// 空心
  ///
  hollow,

  ///
  /// 实心
  ///
  solid
}

///
/// 球的样式
///
class BallStyle {
  ///
  /// 尺寸
  ///
  final double size;

  ///
  /// 实心球颜色
  ///
  final Color color;

  ///
  /// 球的类型 [ BallType ]
  ///
  final BallType ballType;

  ///
  /// 边框宽
  ///
  final double borderWidth;

  ///
  /// 边框颜色
  ///
  final Color borderColor;

  const BallStyle({
    this.size = 10,
    this.color = Colors.white,
    this.ballType = BallType.solid,
    this.borderWidth = 0.0,
    this.borderColor = Colors.white,
  });

  BallStyle copyWith(
      {double? size,
      Color? color,
      BallType? ballType,
      double? borderWidth,
      Color? borderColor}) {
    return BallStyle(
        size: size ?? this.size,
        color: color ?? this.color,
        ballType: ballType ?? this.ballType,
        borderWidth: borderWidth ?? this.borderWidth,
        borderColor: borderColor ?? this.borderColor);
  }

  @override
  bool operator ==(Object other) {
    if (identical(this, other)) return true;
    if (other.runtimeType != runtimeType) return false;
    return other is BallStyle &&
        other.size == size &&
        other.color == color &&
        other.ballType == ballType &&
        other.borderWidth == borderWidth &&
        other.borderColor == borderColor;
  }
}
